package exp1;

import java.util.Scanner;

public class Factorial1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long fact = 1;
        long n = sc.nextInt();
        // start
        long stime = System.nanoTime();
        for (int i = 1; i <= n; i++) {
            fact = fact * i;
        }
        // wnd
        long etime = System.nanoTime();
        System.out.println(fact);
        System.out.println(etime - stime);
    }
}
